home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Languages / Oberon⁄F™ 1.1 / Form / Docu / Controllers (.txt) < prev    next >
Oberon Document  |  1996-01-05  |  5KB  |  125 lines

  1. Documents.StdDocumentDesc
  2. Documents.DocumentDesc
  3. Containers.ViewDesc
  4. Views.ViewDesc
  5. Stores.StoreDesc
  6. Documents.ModelDesc
  7. Containers.ModelDesc
  8. Models.ModelDesc
  9. Stores.ElemDesc
  10. TextViews.StdViewDesc
  11. TextViews.ViewDesc
  12. TextModels.StdModelDesc
  13. TextModels.ModelDesc
  14. TextModels.AttributesDesc
  15. Helvetica
  16. TextRulers.StdRulerDesc
  17. TextRulers.RulerDesc
  18. TextRulers.StdStyleDesc
  19. TextRulers.StyleDesc
  20. TextRulers.AttributesDesc
  21. Helvetica
  22. Helvetica
  23. Helvetica
  24. Helvetica
  25. Helvetica
  26. FormControllers
  27. DEFINITION FormControllers;
  28.     IMPORT Views, Controllers, Containers, FormModels, FormViews;
  29.     CONST noSelection = Containers.noSelection; noFocus = Containers.noFocus;
  30.     TYPE
  31.         Controller = POINTER TO ControllerDesc;
  32.         ControllerDesc = RECORD (Containers.ControllerDesc)
  33.             form-: FormModels.Model;
  34.             view-: FormViews.View;
  35.             PROCEDURE (c: Controller) ThisView (): FormViews.View;
  36.             PROCEDURE (c: Controller) Select (view: Views.View);
  37.             PROCEDURE (c: Controller) Deselect (view: Views.View);
  38.             PROCEDURE (c: Controller) IsSelected (view: Views.View): BOOLEAN;
  39.             PROCEDURE (c: Controller) GetSelection (): List;
  40.             PROCEDURE (c: Controller) SetSelection (l: List)
  41.         END;
  42.         Directory = POINTER TO DirectoryDesc;
  43.         DirectoryDesc = RECORD (Controllers.DirectoryDesc)
  44.             PROCEDURE (d: Directory) New (): Controller;
  45.             PROCEDURE (d: Directory) NewView (f: FormModels.Model; opts: SET): FormViews.View
  46.         END;
  47.         List = POINTER TO ListDesc;
  48.         ListDesc = RECORD
  49.             next: List;
  50.             view: Views.View
  51.         END;
  52.     VAR dir-, stdDir-: Directory;
  53.     PROCEDURE Focus (): Controller;
  54.     PROCEDURE Insert (c: Controller; view: Views.View; l, t, r, b: LONGINT);
  55.     PROCEDURE SetDir (d: Directory);
  56.     PROCEDURE Install;
  57. END FormControllers.
  58. FormControllers are standard controllers for FormViews. Note that forms can only be used in a non-modal way, i.e. a program doesn't wait until the user is finished with the form. In other words: the user is in control, not the computer.
  59. TYPE Controller
  60. Interface, Extension
  61. Standard controllers for form views.
  62. form-: FormModels.Model    form # NIL
  63. The controller's model.
  64. view-: FormViews.View    view # NIL & view.ThisModel() = form
  65. The controller's view.
  66. PROCEDURE (c: Controller) Select (view: Views.View)
  67. Interface
  68. Adds a view to the current selection, if it isn't selected already.
  69. view in c.form    20
  70. ~(noSel IN c.opts)    21
  71. c.IsSelected(view)
  72. c.ThisFocus() = NIL
  73. PROCEDURE (c: Controller) Deselect (view: Views.View)
  74. Interface
  75. Removes a view from the current selection, if it is selected.
  76. view in c.form    20
  77. ~c.IsSelected(view)
  78. PROCEDURE (c: Controller) IsSelected (view: Views.View): BOOLEAN
  79. Interface
  80. Determines whether the given view is currently selected or not. NIL is not considered selected.
  81. view = NIL  OR  view in c.form    20
  82. PROCEDURE (c: Controller) GetSelection (): List
  83. Interface
  84. Returns the list of selected subviews.
  85. all views of the result list are in c.form
  86. PROCEDURE (c: Controller) SetSelection (l: List)
  87. Interface
  88. Removes the existing selection, and selects the subviews of l.
  89. all views of l are in c.form    20
  90. TYPE Directory
  91. Interface, Extension
  92. Directory for form view controllers.
  93. PROCEDURE (d: Directory) New (): Controller
  94. Interface, Extension
  95. Create and return a new form view controller.
  96. result # NIL
  97. result.form = NIL
  98. result.view = NIL
  99. result.opts = {}
  100. PROCEDURE (d: Directory) NewView (m: FormModels.Model; opts: SET): FormViews.View
  101. Interface
  102. Create a new form view with a new controller for form m, and return the view.
  103. result # NIL    
  104. result.ThisModel() = m
  105. result.ThisController() # NIL
  106. result.ThisController().opts = opts
  107. VAR dir-, stdDir-: Directory
  108. Controller directories.
  109. PROCEDURE Focus (): Controller
  110. Returns the focus controller, if the focus currently is a form view, otherwise it returns NIL.
  111. PROCEDURE Insert (c: Controller; view: Views.View; l, t, r, b: LONGINT)
  112. Inserts view into c's view at the position (l, t, r, b). If necessary, the position is slightly corrected (rounded) such that view's top-left corner comes to lie on the grid. The size of view is not changed, however.
  113. PROCEDURE SetDir (d: Directory)
  114. Set directory d.
  115. d # NIL    20
  116. dir = d
  117. PROCEDURE Install
  118. Used internally.
  119. TextControllers.StdCtrlDesc
  120. TextControllers.ControllerDesc
  121. Containers.ControllerDesc
  122. Controllers.ControllerDesc
  123. Helvetica
  124. Documents.ControllerDesc
  125.